# Maintainer: Alexey Pavlov <Alexpux@gmail.com>

pkgname=zip
pkgver=3.0
pkgrel=3
pkgdesc="Creates PKZIP-compatible .zip files"
arch=('i686' 'x86_64')
url="http://www.info-zip.org/Zip.html"
license=('BSD')
depends=('libbz2')
options=('!makeflags')
groups=('compression')
source=("ftp://ftp.info-zip.org/pub/infozip/src/${pkgname}${pkgver//./}.tgz"
        'zip-3.0-11.src.patch'
        'zip-3.0-build.patch')
sha256sums=('f0e8bb1f9b7eb0b01285495a2699df3a4b766784c1765a8f1aeedf63c0806369'
            '3b4ca1a1e8878be92c778d4dc1849787860dcbd8bcd5b4eeffbf98a3afc74acb'
            'a66386c3a48019d8063a48c3610a28862412926f04a3b8f44662c6a87bb250f5')

prepare() {
   cd "${srcdir}/${pkgname}${pkgver//./}"
   patch -p2 -i ${srcdir}/zip-3.0-11.src.patch
   patch -p1 -i ${srcdir}/zip-3.0-build.patch
}

build() {
   cd "${srcdir}/${pkgname}${pkgver//./}"
   make -f unix/Makefile cygwin LOCAL_ZIP="$CFLAGS -DFORCE_UNIX_OVER_WIN32" prefix=/usr
}

package() {
   cd "${srcdir}/${pkgname}${pkgver//./}"
   make -f unix/Makefile prefix=${pkgdir}/usr \
     MANDIR=${pkgdir}/usr/share/man/man1 E=.exe install
   install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
}
